package aiproject3.models;

import java.util.HashMap;


public class Gaussian implements KnowledgeBase<Character, Double>{

    private HashMap<Character,DiscreteGaussianDistribution> data;
    private int time = 0;
    
    public Gaussian() {
        
        data = new HashMap<Character,DiscreteGaussianDistribution>();
        
    }
    
    public void addToModel(Character unit) {
        
        //System.out.println("Updating Gaussian model with " + unit);
        
        if(!data.containsKey(unit)) {
            data.put(unit, new DiscreteGaussianDistribution());
            data.get(unit).addSample(time);
        } else {
            data.get(unit).addSample(time);
        }
        
        time++;
        
    }

    public boolean contains(Character unit) {
        return data.containsKey(unit);
    }

    public int getNumUnits() {
        return data.keySet().size();
    }

    public Double getValueFromModel(Character unit) {
        return data.get(unit).pdf(time+1);
    }

    
}
